package com.fulu.netty.luban.nio;

import java.nio.ByteBuffer;

/**
 * wrap方式创建ByteBuffer
 */
public class Demo9 {
    public static void main(String[] args) {
        byte[] bytes = {'a', 'b', 'c'};
        ByteBuffer buffer = ByteBuffer.wrap(bytes);
        bytes[0] = 'e';
        buffer.put(2, (byte) 'e');
        for (int i = 0; i < buffer.capacity(); i++) {
            System.out.println((char) buffer.get());
        }
    }
}
